﻿Imports System
Imports System.IO
Imports System.Data.OleDb
Imports System.Data


Partial Class Backend_ManageSpecs
    Inherits System.Web.UI.Page

 

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If (Session("ADMIN_USER") IsNot Nothing) Then
            If IsPostBack Then Exit Sub
            Call loadData()
        Else
            Response.Redirect("Default.aspx")
            
        End If

    End Sub

    Public Sub loadData()
        Dim cn As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("../App_Data\arwani.mdb"))
        Dim strQ As String = "select * from specs"
        Dim da As New OleDbDataAdapter(strQ, cn)


        Dim dtTable As New DataTable
        da.Fill(dtTable)
        da.Dispose()
        cn.Dispose()




        Me.dgSpecs.DataSource = dtTable
        Me.dgSpecs.DataBind()

    End Sub

    Protected Sub dgSpecs_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) Handles dgSpecs.ItemDataBound
        Try
            Dim lnkDelete As LinkButton = CType(e.Item.FindControl("lnkDelete"), LinkButton)
            lnkDelete.Attributes.Add("onclick", "return confirm('Confirm delete this category?')")
        Catch ex As Exception

        End Try
    End Sub
    Protected Sub dgSpecs_PageIndexChanged(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridPageChangedEventArgs) Handles dgSpecs.PageIndexChanged
        Me.dgSpecs.CurrentPageIndex = e.NewPageIndex
        Call loadData()
    End Sub
End Class
